package cn.smile.commons.enums.core;

import lombok.Getter;
import org.springframework.util.ObjectUtils;

import java.util.Objects;

@Getter
public enum DicParentEnum {
    SHARE_RELATION("1777877567770038274", "共享关系"),
    NOTEBOOK_TYPE("1868907376092954626", "日记类型"),
    NULL("-1", "未知");

    private final String id;
    private final String msg;

    DicParentEnum(String id, String msg) {
        this.id = id;
        this.msg = msg;
    }

    public static DicParentEnum get(String id) {
        if (!ObjectUtils.isEmpty(id)) {
            for (DicParentEnum parent : values()) {
                if (Objects.equals(parent.getId(), id)) {
                    return parent;
                }
            }
        }
        return NULL;
    }
}
